package com.nav.backend.mapper;

import com.nav.backend.pojo.RingSearch;
import com.nav.backend.pojo.TreeLineSearch;
import com.nav.backend.pojo.TwoPointsSearch;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * HistoryMapper 接口用于定义和搜索历史相关的数据库操作
 *
 * @author xiukira
 */
@Mapper
public interface HistoryMapper {
    /**
     * 获取所有起终点搜索历史
     *
     * @param account String 账户名
     * @return 起终点搜索历史列表 List<TwoPointsSearch>
     */
    @Select("select * from two_points_search where account = #{account}")
    List<TwoPointsSearch> twoPointListAll(String account);

    /**
     * 删除起终点搜索历史
     *
     * @param twoPointsSearchId Integer 起终点搜索历史id
     */
    @Delete("delete from two_points_search where two_points_search_id = #{twoPointsSearchId}")
    void twoPointDelete(Integer twoPointsSearchId);

    /**
     * 清空起终点搜索历史
     *
     * @param account String 账户名
     */
    @Delete("delete from two_points_search where account = #{account}")
    void twoPointDeleteAll(String account);

    /**
     * 获取所有环形搜索历史
     *
     * @param account String 账户名
     * @return 环形搜索历史列表 List<RingSearch>
     */
    @Select("select * from ring_search where account = #{account}")
    List<RingSearch> ringListAll(String account);

    /**
     * 删除环形搜索历史
     *
     * @param ringSearchId Integer 环形搜索历史id
     */
    @Delete("delete from ring_search where ring_search_id = #{ringSearchId}")
    void ringDelete(Integer ringSearchId);

    /**
     * 清空环形搜索历史
     *
     * @param account String 账户名
     */
    @Delete("delete from ring_search where account = #{account}")
    void ringDeleteAll(String account);

    /**
     * 获取所有林荫道搜索历史
     *
     * @param account String 账户名
     * @return 林荫道搜索历史列表 List<TreeLineSearch>
     */
    @Select("select * from tree_line_search where account = #{account}")
    List<TreeLineSearch> treeLineListAll(String account);

    /**
     * 删除环形搜索历史
     *
     * @param treeLineSearchId Integer 林荫道搜索历史id
     */
    @Delete("delete from tree_line_search where tree_line_search_id = #{treeLineSearchId}")
    void treeLineDelete(Integer treeLineSearchId);

    /**
     * 清空林荫道搜索历史
     *
     * @param account String 账户名
     */
    @Delete("delete from tree_line_search where account = #{account}")
    void treeLineDeleteAll(String account);
}
